<%-- 
    Document   : Dbtest2.jsp
    Created on : Apr 27, 2008, 9:49:01 PM
    Author     : Administrator
--%>

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h2>test for Oracle</h2>
        <% 
            // connection driver for database
            Class.forName("com.mysql.jdbc.Driver").newInstance(); 
            //                                                 // Database URL/database username password
            Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/airline","root","123456"); 
            Statement stmt=con.createStatement(); 
            ResultSet rst=stmt.executeQuery("select * from mytable"); 
            while(rst.next()) 
            { 
            out.print(rst.getString("name"));
            out.print("  ");
            out.print(rst.getString("birthaddr"));
            out.print("<br>");
            } 
            rst.close(); 
            stmt.close(); 
            con.close(); 
        %> 

    </body>
</html>
